From: Sebastian Keller Date: Tue, 16 Feb 2021 02:50:52 +0000 (+0100) Subject: workspacesView: Don't invalidate allocation before using it for gesture X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~328 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8d5fb73695682b99c2a1c6db361474984e2196ac;p=gnome-shell.git workspacesView: Don't invalidate allocation before using it for gesture Calling startTouchGesture() on the workspacesViews can change the visibility of the workspaces if not all of them are already shown, such as when there are more than 3 workspaces or for 3 workspaces if we are not on the central one. This invalidates the allocation and the width used as distance for the gesture would become 0, resulting in drag gestures immediately jumping to the first or last workspace due to a division by 0. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3721 Part-of: --- diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 0cfe91561..177fd413d 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -716,12 +716,12 @@ class WorkspacesDisplay extends St.Widget { ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL; + const distance = global.workspace_manager.layout_rows === -1 + ? this.height : this.width; + for (let i = 0; i < this._workspacesViews.length; i++) this._workspacesViews[i].startTouchGesture(); - let distance = global.workspace_manager.layout_rows === -1 - ? this.height : this.width; - let progress = adjustment.value / adjustment.page_size; let points = Array.from( { length: workspaceManager.n_workspaces }, (v, i) => i);